/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2024-04-04
 * Time: 21:34
 */
public class Demo {
    public int lengthOfLongestSubstring(String ss){
        int left=0;
        int right=0;
        char[] s=ss.toCharArray();
        int[] hash=new int[128];
        int size=0;
        for (; right<s.length ; right++) {
            hash[s[right]]++;
            while(hash[s[right]]>1){
                hash[s[left]]--;

            }
            size=Math.max(size,right-left+1);


        }
        return  size;
    }
}
